package com.example.flow.dao.model;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.beans.BeanUtils;

import javax.persistence.Table;

/**
 * 流程任务
 *
 * @author tangaq
 * 2023/6/15
 */
@Table(name = "flow_task_his")
@Data
@EqualsAndHashCode(callSuper = true)
public class FlowTaskHis extends BaseEntity {
    private static final long serialVersionUID = -8802518168018737948L;

    private String hisTaskId;

    private String taskId;

    private String parentTaskId;

    private String parentTaskName;

    private String orderId;

    private String taskName;

    private String finishTime;
    /**
     * 认为状态(0:结束，1：活动)
     */
    private Integer taskState;

    private String operator;

    public FlowTaskHis() {

    }

    public FlowTaskHis(FlowTask task) {
        this.taskId = task.getTaskId();
        this.parentTaskId = task.getParentTaskId();
        this.parentTaskName = task.getParentTaskName();
        this.orderId = task.getOrderId();
        this.taskName = task.getTaskName();
        this.operator = task.getOperator();
    }

    public FlowTask getRedoTask() {
        FlowTask task = new FlowTask();
        BeanUtils.copyProperties(this, task);
        return task;
    }
}
